package main

import (
	"fmt"
	"sort"
)

func main() {

	var nameList = [3]string{"张三", "李四", "王五"}
	fmt.Println(nameList)
	fmt.Println(nameList[0])
	fmt.Println(nameList[2])
	fmt.Println(nameList[len(nameList)-1])

	// 切片
	var numbers []int
	fmt.Println(numbers)
	fmt.Println(numbers == nil)
	//numbers = []int{}
	numbers = make([]int, 0)
	fmt.Println(numbers)
	fmt.Println(numbers == nil)
	numbers = append(numbers, 1)
	numbers = append(numbers, 2)
	fmt.Println(numbers)

	numbers2 := make([]int, 2, 3)
	fmt.Println(numbers2)
	fmt.Println(numbers2[1:])

	numbers3 := []int{1, 2, 3}
	sort.Ints(numbers3)
	fmt.Println(numbers3)
	reverse := sort.Reverse(sort.IntSlice(numbers3))
	sort.Sort(reverse)
	fmt.Println(numbers3)
}
